//package com.punch.course.controller;
//
//import cn.hutool.core.util.StrUtil;
//import com.punch.common.dto.course.ClassDTO;
//import com.punch.common.dto.course.ClassSupplierDTO;
//import com.punch.common.dto.course.ClassTeacherDTO;
//import com.punch.common.enums.course.ClassAuditEnum;
//import com.punch.common.model.Result;
//import com.punch.common.page.PageInfo;
//import com.punch.common.vo.common.OptionVO;
//import com.punch.common.vo.course.*;
//import com.punch.common.vo.course.classes.AppCourseClassPageVO;
//import com.punch.common.vo.course.classes.ClassVO;
//import com.punch.course.excel.StudentSignUpExcel;
//import com.punch.course.exception.CourseExceptionEnum;
//import com.punch.course.query.ClassQueryInfo;
//import com.punch.course.service.ClassService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletResponse;
//import javax.validation.Valid;
//import java.io.IOException;
//import java.time.LocalDate;
//import java.util.List;
//
//
///**
// * 班级管理
// *
// * @author xiaol
// * @version 1.0.0
// * @since 2020/7/21
// */
//@RestController
//@Api(value = "ClassController", tags = "班级管理Controller")
//@Deprecated
//public class ClassController {
//
//    @Resource
//    private ClassService classService;
//
//    /**
//     * 条件分页查询班级列表
//     *
//     * @return IPage<ClassRoomPageVO>
//     * @author xiaol
//     * @since 2020/7/14 10:51
//     */
////    @GetMapping(value = "/classes", produces = "application/json; charset=utf-8")
//    @ApiOperation(value = "条件分页查询班级列表", notes = "条件分页查询班级列表", produces = "application/json")
//    public Result<PageInfo<ClassPageVO>> listClass(@ModelAttribute ClassQueryInfo classQueryInfo) {
//        return Result.succeed(classService.listClass(classQueryInfo));
//    }
//
//    /**
//     * 简单班级列表
//     *
//     * @return SimpleClassesVO
//     */
//    @GetMapping(value = "/classes/simple", produces = "application/json; charset=utf-8")
//    @ApiOperation(value = "简单班级列表", notes = "条件分页查询班级列表", produces = "application/json")
//    public Result<List<SimpleClassesVO>> listSimpleClass(@RequestParam(value = "schoolId", defaultValue = "0") Long schoolId) {
//        return Result.succeed(classService.listSimpleClass(schoolId));
//    }
//
//    /**
//     * 查询班级详情
//     *
//     * @param classId 班级记录id
//     * @return ClassRoomForm
//     * @author xiaol
//     * @since 2020/7/14 10:51
//     */
//   // @GetMapping(value = "/class/{classId}", produces = "application/json; charset=utf-8")
//    @ApiOperation(value = "查询班级详情", notes = "查询班级详情", produces = "application/json")
//    public Result<ClassVO> getClassById(@PathVariable Long classId) {
//        return Result.succeed(classService.getClassById(classId));
//    }
//
//    /**
//     * 保存班级信息
//     *
//     * @param classDTO 班级信息表单
//     * @return classId
//     * @author xiaol
//     * @since 2020/7/21
//     */
//
////    @PostMapping(value = "/class", produces = "application/json; charset=utf-8")
//    @ApiOperation(value = "保存班级信息", notes = "保存班级信息", produces = "application/json")
//    public Result saveClass(@Valid @RequestBody ClassDTO classDTO) {
//        Long classId = classService.saveClass(classDTO);
//        return Result.succeed(classId, CourseExceptionEnum.CLASS_SAVE_SUCCESS.getMsg());
//    }
//
//    /**
//     * 修改班级信息
//     *
//     * @param classDTO 班级信息表单
//     * @return classId
//     * @author xiaol
//     * @since 2020/7/21
//     */
//
////    @PutMapping(value = "/class", produces = "application/json; charset=utf-8")
//    @ApiOperation(value = "修改班级信息", notes = "修改班级信息", produces = "application/json")
//    public Result updateClass(@Valid @RequestBody ClassDTO classDTO) {
//        Long classId = classService.updateClass(classDTO);
//        return Result.succeed(classId, CourseExceptionEnum.CLASS_EDIT_SUCCESS.getMsg());
//    }
//
//    /**
//     * 删除班级信息
//     *
//     * @param classId 班级id
//     * @return 删除提示消息
//     * @author xiaol
//     * @since 2020/7/21
//     */
////    @DeleteMapping(value = "/class/{classId}", produces = "application/json; charset=utf-8")
//    @ApiOperation(value = "删除班级信息", notes = "删除班级信息", produces = "application/json")
//    public Result<String> deleteClassById(@PathVariable Long classId) {
//        classService.deleteClassById(classId);
//        return Result.succeed(CourseExceptionEnum.CLASS_DEL_SUCCESS.getMsg());
//    }
//
//
//    /**
//     * 班级启用/停用
//     */
//    @PutMapping("/class/enable/{classId}")
//    @ApiOperation(value = "班级启用/停用")
//    public Result enableClass(@PathVariable Long classId) {
//        classService.enableClass(classId);
//        return Result.succeed("修改成功");
//    }
//
//
//    /**
//     * 班级开始报名
//     */
//    @PutMapping("/class/sign-up/{classId}")
//    @ApiOperation(value = "班级开始报名")
//    public Result signUpClass(@PathVariable Long classId) {
//        classService.updateClassStatus(classId, ClassAuditEnum.IN_SIGN_UP.getCode());
//        return Result.succeed("班级开始报名");
//    }
//
//    /**
//     * 班级开班
//     */
//    @PutMapping("/class/begin/{classId}")
//    @ApiOperation(value = "班级开班")
//    public Result beginClass(@PathVariable Long classId) {
//        classService.updateClassStatus(classId, ClassAuditEnum.BEGIN_CLASS.getCode());
//        return Result.succeed("班级开班");
//    }
//
//
//    /**
//     * app学生可选课程列表
//     *
//     * @return PageInfo<AppCourseClassPageVO>
//     * @author xiaol
//     * @since 2020/7/23
//     */
//    @GetMapping(value = "/class/courses/app", produces = "application/json; charset=utf-8")
//    @ApiOperation(value = "app学生可选课程列表", notes = "app学生可选课程列表", produces = "application/json")
//    public Result<PageInfo<AppCourseClassPageVO>> listClassForApp(@ModelAttribute ClassQueryInfo classQueryInfo) {
//        return Result.succeed(classService.listClassForApp(classQueryInfo));
//    }
//
//    /**
//     * app端班级课程详情
//     *
//     * @return List<ClassCourseVO>
//     * @author xiaol
//     * @since 2020/7/23
//     */
//    @GetMapping(value = "/class/course/app/{classId}", produces = "application/json; charset=utf-8")
//    @ApiOperation(value = "app端班级课程详情", notes = "app端班级课程详情", produces = "application/json")
//    public Result<AppClassVO> getClassForApp(@PathVariable Long classId, @RequestParam("studentId") Long studentId) {
//        return Result.succeed(classService.getClassForApp(classId, studentId));
//    }
//
//
//    /**
//     * 服务查询班级详情
//     *
//     * @param classId 班级记录id
//     * @return FeignClassVO
//     * @author xiaol
//     * @since 2020/7/14 10:51
//     */
////    @GetMapping(value = "/class/feign/{classId}", produces = "application/json; charset=utf-8")
////    @ApiOperation(value = "服务查询班级详情", notes = "查询班级详情", produces = "application/json")
//    public AppClassVO getFeignClassById(@PathVariable Long classId) {
//        return classService.getClassForApp(classId, 0L);
//    }
//
//
//    /**
//     * 更改教师
//     *
//     * @return int
//     */
//    @PutMapping(value = "/class/teacher", produces = "application/json; charset=utf-8")
//    @ApiOperation(value = "更改教师", notes = "更改教师", produces = "application/json")
//    public Result<Long> updateTeacher(@RequestBody ClassTeacherDTO classTeacherDTO) {
//        return Result.succeed(classService.updateTeacher(classTeacherDTO));
//    }
//
//    /**
//     * 根据课程分类id查询课程详情列表
//     *
//     * @return List<ClassesVO>
//     * @author xiaol
//     * @since 2020/7/23
//     */
//    @GetMapping(value = "/classes/{categoryId}")
//    @ApiOperation(value = "根据课程分类id查询课程详情列表", notes = "根据课程分类id查询课程详情列表", produces = "application/json")
//    public List<ClassesVO> getClasses(@PathVariable Long categoryId) {
//        return classService.getClasses(categoryId);
//    }
//
//
//    /**
//     * 指定供应商
//     *
//     * @return int
//     */
//    @PutMapping(value = "/class/supplier", produces = "application/json; charset=utf-8")
//    @ApiOperation(value = "指定供应商", notes = "指定供应商", produces = "application/json")
//    public Result<Long> updateSupplier(@RequestBody ClassSupplierDTO classSupplierDTO) {
//        return Result.succeed(classService.updateSupplier(classSupplierDTO));
//    }
//
//    /**
//     * 报名修改班级课程的报名人数
//     *
//     * @param courseClassId 班级课程id
//     */
////    @PutMapping(value = "/class/{courseClassId}/sign-up-number", produces = "application/json; charset=utf-8")
//    public Boolean updateSignUpNumber(@PathVariable("courseClassId") Long courseClassId) {
//        return classService.updateSignUpNumber(courseClassId);
//    }
//
//    /**
//     * 取消订单修改班级课程的报名人数
//     *
//     * @param courseClassId 班级课程id
//     */
//    @PutMapping(value = "/class/{courseClassId}/sign-up-cancel", produces = "application/json; charset=utf-8")
//    public Boolean cancelSignUpNumber(@PathVariable("courseClassId") Long courseClassId) {
//        return classService.cancelSignUpNumber(courseClassId);
//    }
//
//    /**
//     * 获取课程班级教具结算信息
//     *
//     * @param courseClassId 班级课程id
//     */
//    @PutMapping(value = "/class/{courseClassId}/material-settlement", produces = "application/json; charset=utf-8")
//    public MaterialSettlementVO getMaterialSettlement(@PathVariable("courseClassId") Long courseClassId) {
//        return classService.getMaterialSettlement(courseClassId);
//    }
//
//    /**
//     * 查找未结算完成的课程,每月执行一次
//     */
//    @PutMapping(value = "/class/course/un-settlement", produces = "application/json; charset=utf-8")
//    public List<CourseSettlementVO> listCourseSettlement() {
//        return classService.listCourseSettlement();
//    }
//
//
//    /**
//     * 上课课表信息导出
//     *
//     * @param classId   课程id
//     * @param type      类型 0-班级课表 1-学生签到课表
//     * @param localDate type为有效 具体某期的课表
//     * @param response  返回内容
//     * @throws IOException
//     */
//    @GetMapping(value = "/class/export/sign-up/{classId}", produces = "application/json; charset=utf-8")
//    public void exportSignUp(@PathVariable Long classId,
//                             @RequestParam(value = "type", defaultValue = "0") Integer type,
//                             @RequestParam(value = "classSate", required = false) String localDate,
//                             HttpServletResponse response) throws IOException {
//        classService.exportSignUp(classId, type, localDate, response);
//    }
//
//    /**
//     * 批量导出学生课表
//     *
//     * @param classIds 课程ids
//     * @param response 返回内容
//     * @throws IOException
//     */
//    @GetMapping(value = "/class/export-batch/sign-up", produces = "application/json; charset=utf-8")
//    public void batchExportSignUp(@RequestParam("classIds") List<Long> classIds,
//                                  HttpServletResponse response) throws IOException {
//        classService.batchExportSignUp(classIds, response);
//    }
//
//    /**
//     * 出勤学生列表
//     *
//     * @param classId   课程id
//     * @param classDate 上课日期
//     */
//    @GetMapping(value = "/class/attendance/{classId}", produces = "application/json; charset=utf-8")
//    public Result<PageInfo<StudentSignUpExcel>> listAttendance(@PathVariable Long classId,
//                                                               @RequestParam(value = "classDate") String classDate,
//                                                               @RequestParam(value = "studentName", required = false) String studentName,
//                                                               @RequestParam(value = "currPage", defaultValue = "1") Integer currPage,
//                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
//        if (StrUtil.isEmpty(classDate)) {
//            return Result.succeed(new PageInfo<>(1, 10));
//        }
//        LocalDate localDate = LocalDate.parse(classDate);
//        return Result.succeed(classService.listAttendance(classId, localDate, studentName, currPage, pageSize));
//    }
//
//    /**
//     * 课程班级课节列表
//     *
//     * @param classId 班级课程id
//     * @return Integer
//     */
//    @GetMapping(value = "/class/course-date/{classId}", produces = "application/json; charset=utf-8")
//    @ApiOperation(value = "课程班级课节列表", notes = "课程班级课节列表", produces = "application/json")
//    public Result<List<OptionVO<LocalDate>>> listCourseDate(@PathVariable Long classId) {
//        return Result.succeed(classService.listCourseDate(classId));
//    }
//}
